//graham matuszewski
#pragma once

#ifndef PARTONE_H_
#define PARTONE_H_

#include <iostream>
#include "Enums.h"
#include "Structs.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "GantryAgent.h"
#include "FeederAgent.h"
#include "LaneAgent.h"
#include "GUILaneMock.h"
#include <string>
#include "NestAgentMock.h"
//test of the feeder

TEST(GrahamNathan,yeah){

	GantryAgent gantry("Gantry Baby");
	FeederAgent feeder1("Feeder One");
	LaneAgent lane1("Lane One");
	LaneAgent lane2("Lane Two");
	GUILaneMock guiMock;
	NestAgentMock nestMock;

	gantry.setFeeder1(&feeder1);
	gantry.setFeeder2(&feeder1);
	gantry.setFeeder3(&feeder1);
	gantry.setFeeder4(&feeder1);
	feeder1.setLaneTop(&lane1);
	feeder1.setLaneBottom(&lane1);
	feeder1.setGantry(&gantry);
	lane1.setFeeder(&feeder1);
	lane1.setGUI(&guiMock);
	lane1.setNest(&nestMock);

	lane1.testing=true;

	PartType newPart = A;

	lane1.msgPleaseGetParts(newPart);
	//EXPECT_CALL(feeder1,msgPleaseGetParts(newPart,lane1));
	lane1.pickAndExecuteAnAction();// THIS PURGES THE LANE

	feeder1.pickAndExecuteAnAction(); //THIS SENDS A MESSAGE PLEASEGETPARTS TO THE GANTRY

	gantry.pickAndExecuteAnAction();	//THE GANTRY ASKS IF THE FEEDER IS CLEAR
	gantry.pickAndExecuteAnAction();	//THE 
	feeder1.pickAndExecuteAnAction();
	gantry.pickAndExecuteAnAction();
	gantry.pickAndExecuteAnAction();

	PartRecipe recipe;
	recipe.partType=newPart;
	recipe.topLane=false;
	FeederOrder order(recipe,0);
	//order.feederNumber=0;
	//order.partRecipe=newPart;
	gantry.msgGUIHalfDoneMoving(order);
	gantry.msgGUIDoneMoving();
	gantry.pickAndExecuteAnAction();
	feeder1.pickAndExecuteAnAction();
	//feeder1.pickAndExecuteAnAction();
	//EXPECT_CALL(nestMock,msgIThinkYoureFull()); // Graham Matuszewski  This message waits for a timer to execute. Because of the way gtest operates you have to uncomment out the std::getchar() at the bottom then wait for the timer to execute and then it works. I have run this multiple times and can assure you it works. 
	
	//std::getchar();
	
	
	lane1.pickAndExecuteAnAction();



	//QDebug("Pleases wait 30 seconds for timers");
	//std::getchar();
}

#endif